laravel check collection not empty

40

laravel check collection not empty -

if ($mentor->first()) { } 
if (!$mentor->isEmpty()) { }
if ($mentor->count()) { }
if (count($mentor)) { }
if ($mentor->isNotEmpty()) { }

laravel collection isEmpty -

collect([])->isEmpty();

// true

Comments

Submit
0 Comments